package GoodsService

import (
	"context"
	toolsDb "gdshop-back-end-go/common/db"
)

// 获取正文
// goodsId 商品ID
// typeString 类型 pc和mobile
func GetGoodsContent(ctx context.Context, goodsId int, typeString string) string {
	fieldName := ""
	if typeString == "pc" {
		fieldName = "goods_content"
	} else {
		fieldName = "goods_mobile_content"
	}
	con, err := toolsDb.GetUnSafaTableAddDeleteWhere(ctx, "goods_extend").Where("goods_id=?",
		goodsId).Value(fieldName)

	if err != nil {
		return ""
	}

	return con.String()
}
